#!/usr/bin/env/python3
# -*- coding: utf-8 -*-

"""
@Time    : 2020/3/12 19:25
@Author  : Chen Liu
@FileName: zhong_shu.py
@Software: PyCharm
"""


def count_num(n, num_list):
    if not num_list:
        return 0

    d = {}
    for i in range(n):
        d[num_list[i]] = d.get(num_list[i], 0) + 1

    values = list(d.values())
    max_element = sorted(values)[-1]
    key = list(d.keys())[values.index(max_element)]
    return d, key


def get_res(n, x, num_list):
    num_list = [int(k) for k in num_list.split()]
    d, max_ele = count_num(n, num_list)
    print(d)
    element = max_ele | x
    if element != max_ele and element in d:
        d[element] = d.get(element) + d[max_ele]

    for num in num_list:
        if num != max_ele:
            key = num | x
            d[key] = d.get(key, 0) + 1

    values = list(d.values())
    print(values)
    max_element = sorted(values)[-1]

    return max_element


def get_result(n, x, num_list):
    num_list = [int(k) for k in num_list.split()]
    d, max_ele = count_num(n, num_list)
    print(d)
    for num in num_list:
        key = num | x
        if key != num:
            d[key] = d.get(key, 0) + 1

    values = list(d.values())
    print(values)
    max_element = sorted(values)[-1]

    return max_element


if __name__ == "__main__":
    # n = 5
    # x = 2
    # num_list = '3 1 3 2 5'
    line = input()
    n, x = int(line.split()[0]), int(line.split()[1])
    num_list = input()
    key = get_result(n, x, num_list)
    print(key)
